home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
asm
/
amislib.exe
/
AMISLIB.DOC
< prev
next >
Wrap
Text File
|
1992-09-12
|
15KB
|
395 lines
Alternate Multiplex Interrupt Specification Library
Public Domain 1992 Ralf Brown
Version 0.90
LastEdit: 9/12/92
Files in this library:
AMISLIB.DOC this file
TSRS.DOC usage instructions for sample TSRs and utilities
AMIS.MAC include file defining various macros
AMIS.ASM the actual library code
AMISHOTK.ASM the library's hotkey collision detection code
AMIS.H C include file defining various things
AMITSRS.C sample program to list resident programs using AMIS
FINDTSRS.C function to find all TSRs matching a given name
POPUP.C sample program to request popup of an AMIS TSR
REMOVE.C sample program to remove a specific AMIS TSR
UNINSTAL.ASM TSR remover for REMOVE.C
FASTMOUS.ASM sample TSR
NOLPT.ASM sample TSR -- turn parallel port into bit bucket
SWITCHAR.ASM sample TSR -- provide switchar() for MSDOS 5.0
VGABLANK.ASM sample TSR -- VGA screen blanker
NOTE.ASM sample TSR -- popup note-taker
MAKEFILE make all programs from the library sources
------------------------------------------------------------------------
Advantages of AMISLIB:
totally free
adds only 1K to the executable -- TSRs can be as small as 1.4K
on disk and use little as 128 bytes in memory (hotkey
checking adds another 300 bytes of transient code)
up to 256 AMIS-compliant TSRs can be resident simultaneously
with no interrupt conflicts
resultant TSR can load itself into high memory (either MSDOS 5
upper memory blocks or XMS upper memory blocks); the user has
control over where TSR is allowed to load: high only, low only,
or high first then low; high memory may use either the first or
the best UMB; low memory may use either the low end or the high
end of conventional memory.
TSRs using AMISLIB or other AMIS-compliant code can detect
hotkey conflicts and either abort before installation or
attempt to use alternate hotkeys
TSRs using AMISLIB or other AMIS-compliant code can be unloaded
in any order, and can be unloaded by programs other than the
TSR's original executable
Note: This is still a preliminary version of the library, so there might
be problems. Please let me know if you find any....
------------------------------------------------------------------------
To make use of this library, you basically need to do four things:
1. To each source file that will make calls, add
INCLUDE AMIS.MAC
2. In the source file containing the program's entry point, add
@Startup M,NN,SSS
just after the above INCLUDE and
@Startup2 <Y>
at the program's entry point (see below for details).
3. Change the END line of the main source file to
END INIT
4. Link in AMIS.OBJ (assembled from AMIS.ASM) with the rest of
your object modules. If you are using hotkeys, also link in
AMISHOTK.OBJ.
Limitations:
The ALTMPX and INSTALL_TSR macros must be invoked from the same
source file in order for the installer to properly fix up the
resident AMIS handler. (If not, you will have to perform the
fixup yourself in an 'init' handler for INSTALL_TSR)
AMISLIB currently limits the resident code/data (not counting
the "extra" allocation at installation time) to 64K.
------------------------------------------------------------------------
After an INCLUDE AMIS.MAC, the following definitions and macros are available:
AMIS_VERSION
100 times the version of the specification to which the library
conforms (i.e. 123 = version 1.2.3).
AMISLIB_VERSION
100 times the version of this library
@Startup
Declare all segments and provide some startup code.
Usage: @Startup major,minor,stack
Arguments:
major [opt] the minimum major version of DOS required to run
minor [opt] the major minor version of DOS required to run
stack [opt] the number of bytes of stack to provide at startup
Note:
If either <major> or <minor> is blank, the program will not
check the DOS version at startup. If <stack> is blank, a
default stack of 256 bytes will be provided in memory models
other than Tiny (there is no stack in Tiny model, so this value
will be ignored).
@Startup2
Provide additional startup code at the program's actual entry
point.
Usage: @Startup2 psp
Arguments:
psp [opt] if non-blank, allocate a public variable named __psp
Note:
<psp> should be blank if some other module (such as the C
runtime library) provides a public variable named __psp.
RESIDENT_CODE
The name of the segment to ASSUME or use in overrides when accessing
data within the part of the program which will remain resident.
TGROUP
Group containing all resident segments in the TSR. See also
TGROUP@ and TSRgroup@.
TGROUP@
Symbol to use when loading a segment register to access the TSRs
resident portion in the executable. In Tiny model, this will load
the value of TGROUP from a memory location; in other memory models,
it is identical to TGROUP.
TSRcode@
TSRcodeEnd@
Delimit the code which will remain resident; some of the other
macros listed below will not function correctly unless within a
section of code delimited with TSRcode@ and TSRcodeEnd@.
TSRdata@
TSRdataEnd@
Delimit the initialized data which will remain resident. Requires the
use of TSRgroup@ to function properly.
TSRbss@
TSRbssEnd@
Delimit the uninitialized data which will be placed in the resident
portion (but omitted from the disk image of the executable if
possible). Requires the use of TSRgroup@ to function properly.
TSRgroup@
Declare TGROUP and force the correct ordering of TSRcode@, TSRdata@,
and TSRbss@.
DISPLAY_STRING
Output a '$'-terminated string to standard output via DOS.
Usage:
DISPLAY_STRING string,dataseg
Arguments:
string the label of the string to be displayed
dataseg [opt] the segment of the string
Example:
DISPLAY_STRING banner
...
...
banner db "FOOBAR (c) 1992 Harry Q Bovik",13,10,"$"
CHECK_DOS_VER
Ensure that the program is running under the proper version of DOS,
and terminate with an error message specifying the minimum required
version if not.
Usage:
CHECK_DOS_VER major,minor
Example:
CHECK_DOS_VER 2,00
IF_INSTALLED
Conditionally branch somewhere if the TSR is already installed.
Usage:
IF_INSTALLED dest
Arguments:
dest label to branch to if already installed
Return:
falls through with CF clear if not already installed
branches with CF set and AH = multiplex number if installed
IF_HOTKEY_USED
Conditionally branch somewhere if one or more of the TSR's hotkeys
are already in use.
Usage:
IF_HOTKEY_USED dest
Arguments:
dest label to branch to if hotkey conflict
Return:
falls through with CF clear if no hotkey conflict
branches with CF set and AX = bitmask of conflict types
bit 0: exact key already in use
bit 1: superset key already in use
bit 2: subset key already in use
INSTALL_TSR
Allocate memory for the resident code, copy the resident code to the
allocated memory, hook all interrupts used by the TSR, optionally
call an initialization function, and terminate back to DOS.
Usage:
INSTALL_TSR extra,fit,high,init,if_inst,on_err,more_flags
Arguments:
extra [opt] number of additional paragraphs needed in resident part
fit [opt] FIRST or BEST (default) -fit allocation
high [opt] HIGHONLY to only use UMBs, LOWONLY to only use
conventional memory, TOPMEM to allocate block at high
end of conventional memory if no UMBs, TOPLOW
to only use top end of conventional memory
init [opt] function to call after installing TSR but before exiting
if_inst [opt] label to branch to if already installed
on_err [opt] label to branch to if unable to install
more_flags [opt] label of byte containing additional flags to be ORed
with those automatically set by <fit> and <high>
Notes:
If 'init' is specified, the indicated function will be called with
AX = segment at which TSR was loaded
If 'if_inst' is spe